/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.makrobioklub.action.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author xljan
 */
@Entity
@Table(name = "action_price")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ActionPrice.findAll", query = "SELECT a FROM ActionPrice a"),
    @NamedQuery(name = "ActionPrice.findByIdPrice", query = "SELECT a FROM ActionPrice a WHERE a.idPrice = :idPrice"),
    @NamedQuery(name = "ActionPrice.findByFromDate", query = "SELECT a FROM ActionPrice a WHERE a.fromDate = :fromDate"),
    @NamedQuery(name = "ActionPrice.findByToDate", query = "SELECT a FROM ActionPrice a WHERE a.toDate = :toDate"),
    @NamedQuery(name = "ActionPrice.findByPrice", query = "SELECT a FROM ActionPrice a WHERE a.price = :price"),
    @NamedQuery(name = "ActionPrice.findByPriceMember", query = "SELECT a FROM ActionPrice a WHERE a.priceMember = :priceMember")})
public class ActionPrice implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_price")
    private Integer idPrice = 0;
    @Column(name = "from_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fromDate;
    @Column(name = "to_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date toDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "price")
    private Float price;
    @Column(name = "price_member")
    private Float priceMember;
    @ManyToMany(mappedBy = "actionPriceCollection")
    private Collection<Action> actionCollection;

    public ActionPrice() {
    }

    public ActionPrice(Integer idPrice) {
        this.idPrice = idPrice;
    }

    public Integer getIdPrice() {
        return idPrice;
    }

    public void setIdPrice(Integer idPrice) {
        this.idPrice = idPrice;
    }

    public Date getFromDate() {
        return fromDate;
    }

    public void setFromDate(Date fromDate) {
        this.fromDate = fromDate;
    }

    public Date getToDate() {
        return toDate;
    }

    public void setToDate(Date toDate) {
        this.toDate = toDate;
    }

    public Float getPrice() {
        return price;
    }

    public void setPrice(Float price) {
        this.price = price;
    }

    public Float getPriceMember() {
        return priceMember;
    }

    public void setPriceMember(Float priceMember) {
        this.priceMember = priceMember;
    }

    @XmlTransient
    public Collection<Action> getActionCollection() {
        return actionCollection;
    }

    public void setActionCollection(Collection<Action> actionCollection) {
        this.actionCollection = actionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPrice != null ? idPrice.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ActionPrice)) {
            return false;
        }
        ActionPrice other = (ActionPrice) object;
        if ((this.idPrice == null && other.idPrice != null) || (this.idPrice != null && !this.idPrice.equals(other.idPrice))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "cz.makrobioklub.action.entity.ActionPrice[ idPrice=" + idPrice + " ]";
    }
    
}
